{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" style="width: 300px;" id="n_title" class="layui-input search" name="user_name" placeholder="设计师/订单情况"/>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <select name="laiyuan" class="layui-input">
                                <option value="" >不限来源</option>
                                <option value="1">正常订单</option>
                                <option value="2">设计师订单</option>
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <select name="info_case_id" class="layui-input" lay-search="">
                                <option value="" >不限案例</option>
                                {foreach name="cases" item="t"}
                                <option value="{$t.case_id}">{$t.case_name}</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <select name="info_t_id" class="layui-input" lay-search="">
                                <option value="" >全部分类</option>
                                {foreach name="types" item="t"}
                                <option value="{$t.t_id}">{$t.t_name}</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <select name="info_pp_id" class="layui-input" lay-search="">
                                <option value="" >全部品牌</option>
                                {foreach name="pps" item="t"}
                                <option value="{$t.pp_id}">{$t.pp_name}</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <select name="info_s_id" class="layui-input" lay-search="">
                                <option value="" >全部门店</option>
                                {foreach name="sss" item="t"}
                                <option value="{$t.s_id}">{$t.s_name}</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <select name="info_p_id" class="layui-input" lay-search="">
                                <option value="" >全部装饰城</option>
                                {foreach name="ps" item="t"}
                                <option value="{$t.p_id}">{$t.p_name}</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <select name="info_user_id" class="layui-input" lay-search="">
                                <option value="" >全部设计师</option>
                                {foreach name="users2" item="t"}
                                <option value="{$t.user_id}">{$t.user_d_name}({$t.user_phone})</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="layui-input-inline">
                            <input type="text"  name="start" onfocus="wk.lay_date(this);"  class="layui-input layer-date search" placeholder="订单上传时间-起" />
                        </div>
                        <div class="layui-input-inline">
                            <input type="text"  name="end" onfocus="wk.lay_date(this);"  class="layui-input layer-date search" placeholder="订单上传时间-止" />
                        </div>
                        <div class="layui-input-inline" style="margin-left: 10px;">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button class="layui-btn layui-btn-normal" id="empty" lay-submit="" lay-filter="LAY-search">
                                重置
                            </button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
                <!--操作框开始-->
                <!--<div class="col-sm-12">-->
                    <!--<div class="input-group" >-->
                        <!--<button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">-->
                            <!--<i class="fa fa-wrench"></i> 导出 <span class="caret"></span>-->
                        <!--</button>-->
                        <!--<ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAll"><i class="fa fa-print"></i> 导出汇总</a></li>-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAllDetail"><i class="fa fa-print"></i> 导出明细</a></li>-->
                        <!--</ul>-->
                    <!--</div>-->
                <!--</div>-->
                <!--操作框结束-->
                <div class="col-sm-12">
                    <div class="input-group" >
                        <input type="text" disabled class="layui-input" id="tongji1" value="" style="border:1px solid red;color: red;width: 400px;" />
                    </div>
                </div>
            </div>

            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="testReload"></table>
                    <script type="text/html" id="staBar">
                        <input type="checkbox" value="{{d.info_id}}"  lay-skin="switch"  lay-text="是|否" lay-filter="OnOff" {{ d.info_top == 2 ? 'checked' : '' }}  >
                    </script>
                    <script type="text/html" id="imgTpl2">
                        <ul class="aaasss">
                            {{#  layui.each(d.info_img, function(index, item){ }}
                            <img src="{{item}}" data-original="{{item}}" class="table-img" onerror="this.src='/static/admin/images/head_default.gif'"  />
                            {{#  }); }}
                        </ul>
                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        {{# if(d.info_user_id){ }}
                        <a href="javascript:;" onclick="wk.layer_show('包含案例','{:url('orderInfo')}?info_s_id={{d.info_user_id}}&type=2')" class="btn btn-primary btn-xs m-r-xs" title="包含案例">包含案例</a>
                        {{# } else{ }}
                        <a href="javascript:;" onclick="wk.layer_show('包含案例','{:url('orderInfo')}?info_s_id={{d.info_s_id}}&type=1')" class="btn btn-primary btn-xs m-r-xs" title="包含案例">包含案例</a>
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<textarea id="allidsForOut" class="hidden"></textarea>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Order/index")}'
            , response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
//            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type: 'checkbox', fixed: 'left',}
                , {type: 'numbers', width: 80, title: '序号'}
                , {field: 'case_name', width: '', title: '所属案例', align: 'center'}
                , {field: 'info_designer', width: '', title: '设计师', align: 'center'}
                , {field: 'info_info', width: '', title: '订单情况', align: 'center'}
                , {field: 'user_d_name', width: '', title: '关联设计师', align: 'center'}
                , {field: 't_name', width: '', title: '分类', align: 'center'}
                , {field: 'pp_name', width: '', title: '品牌', align: 'center'}
                , {field: 's_name', width: '', title: '门店', align: 'center'}
                , {field: 'p_name', width: '', title: '装饰城', align: 'center'}
                , {field: 'info_money', width: '', title: '订单金额', align: 'center'}
                , {field: 'info_img', width: '', title: '现场照片', align: 'center',templet: '#imgTpl2'}
                , {field: 'info_time', width: '', title: '上传时间', align: 'center'}
                , {field: 'info_top',fixed: 'right', width: 100, title: '是否推荐', align: 'center', templet: '#staBar'}
                , {fixed: 'right', width: 120, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            , done: function (res, curr, count) {
                $('.aaasss').viewer({
                    url: 'data-original',
                });
                $('#tongji1').val('当前条件下总金额：'+res.allmoney+'元          总数量：'+res.allnums);
            }
        });
        //监听状态开关操作
        form.on('switch(OnOff)', function (obj) {
            var num = '';
            obj.elem.checked == true? num = 2: num = 1;
            //用户状态
            wk.status(this.value,num, '{:url("changeMainStatus")}',obj);
        });
        //批量操作
        var $ = layui.$, active = {
            excelAll: function(){
                //导出Excel
                wk.excelAll('',$('.layui-input').serialize(),"{:url('excelOutOrder')}");
            },
            excelAllDetail: function(){
                //导出Excel
                wk.excelAll('',$('.layui-input').serialize(),"{:url('excelOutDetail')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                , data = checkStatus.data;
            $.each(data, function (index, item) {
                ids.push(item['n_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>